
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Acquiring Source Code for PAs · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-page-footer-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-ace/ace.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="styles.css">
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="PA1.html" />
    
    
    <link rel="prev" href="0.6.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="PA0.html">
            
                <a href="PA0.html">
            
                    
                    PA0 - 世界诞生的前夜: 开发环境配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="0.1.html">
            
                <a href="0.1.html">
            
                    
                    Installing a GNU/Linux VM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="0.2.html">
            
                <a href="0.2.html">
            
                    
                    First Exploration with GNU/Linux
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="0.3.html">
            
                <a href="0.3.html">
            
                    
                    Installing More Tools
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="0.4.html">
            
                <a href="0.4.html">
            
                    
                    More Exploration
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="0.5.html">
            
                <a href="0.5.html">
            
                    
                    Logging in via SSH
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="0.6.html">
            
                <a href="0.6.html">
            
                    
                    Transferring Files between host and VM
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.7" data-path="0.7.html">
            
                <a href="0.7.html">
            
                    
                    Acquiring Source Code for PAs
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="PA1.html">
            
                <a href="PA1.html">
            
                    
                    PA1 - 洞察世界的视点: 简易调试器
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="1.1.html">
            
                <a href="1.1.html">
            
                    
                    在开始愉快的PA之旅之前
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="1.2.html">
            
                <a href="1.2.html">
            
                    
                    RTFSC
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="1.3.html">
            
                <a href="1.3.html">
            
                    
                    简易调试器
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.1" data-path="1.3.1.html">
            
                <a href="1.3.1.html">
            
                    
                    基本功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2" data-path="1.3.2.html">
            
                <a href="1.3.2.html">
            
                    
                    表达式求值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.3" data-path="1.3.3.html">
            
                <a href="1.3.3.html">
            
                    
                    监视点
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="1.4.html">
            
                <a href="1.4.html">
            
                    
                    熟悉i386手册
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="PA2.html">
            
                <a href="PA2.html">
            
                    
                    PA2 - 不停计算的机器: 指令系统
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="2.1.html">
            
                <a href="2.1.html">
            
                    
                    x86指令系统简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="2.2.html">
            
                <a href="2.2.html">
            
                    
                    RTFSC(2)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="2.3.html">
            
                <a href="2.3.html">
            
                    
                    运行第一个C程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="2.4.html">
            
                <a href="2.4.html">
            
                    
                    实现更多的指令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="2.5.html">
            
                <a href="2.5.html">
            
                    
                    简易调试器(2)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="2.6.html">
            
                <a href="2.6.html">
            
                    
                    实现加载程序的loader
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="2.7.html">
            
                <a href="2.7.html">
            
                    
                    运行hello-str程序
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="PA3.html">
            
                <a href="PA3.html">
            
                    
                    PA3 - 虚实交错的魔法: 存储管理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="3.1.html">
            
                <a href="3.1.html">
            
                    
                    Cache的故事
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="3.2.html">
            
                <a href="3.2.html">
            
                    
                    IA-32的故事
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.2.1" data-path="3.2.1.html">
            
                <a href="3.2.1.html">
            
                    
                    混沌初开
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.2" data-path="3.2.2.html">
            
                <a href="3.2.2.html">
            
                    
                    建立新秩序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.3" data-path="3.2.3.html">
            
                <a href="3.2.3.html">
            
                    
                    迈进新时代
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.4" data-path="3.2.4.html">
            
                <a href="3.2.4.html">
            
                    
                    从一到无穷大
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="PA4.html">
            
                <a href="PA4.html">
            
                    
                    PA4 - 来自外部的声音: 中断与I/O
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="4.1.html">
            
                <a href="4.1.html">
            
                    
                    穿越时空的旅程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="4.2.html">
            
                <a href="4.2.html">
            
                    
                    时空之旅大揭秘
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="4.3.html">
            
                <a href="4.3.html">
            
                    
                    天外有天的世界
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="4.4.html">
            
                <a href="4.4.html">
            
                    
                    加入最后的拼图
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="4.5.html">
            
                <a href="4.5.html">
            
                    
                    移植打字小游戏
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="4.6.html">
            
                <a href="4.6.html">
            
                    
                    通往高速的次元
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="4.7.html">
            
                <a href="4.7.html">
            
                    
                    移植仙剑奇侠传
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="4.8.html">
            
                <a href="4.8.html">
            
                    
                    编写不朽的传奇
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="blank.html">
            
                <a href="blank.html">
            
                    
                    杂项
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="why.html">
            
                <a href="why.html">
            
                    
                    为什么要学习计算机系统基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="submit.html">
            
                <a href="submit.html">
            
                    
                    实验提交要求
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="linux.html">
            
                <a href="linux.html">
            
                    
                    Linux入门教程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="man.html">
            
                <a href="man.html">
            
                    
                    man入门教程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="git.html">
            
                <a href="git.html">
            
                    
                    git入门教程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="i386-typo.html">
            
                <a href="i386-typo.html">
            
                    
                    i386手册勘误
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="name.html">
            
                <a href="name.html">
            
                    
                    学生名单
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.7.1" data-path="PA0-feedback.html">
            
                <a href="PA0-feedback.html">
            
                    
                    PA0提交情况
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7.2" data-path="PA1-feedback.html">
            
                <a href="PA1-feedback.html">
            
                    
                    PA1提交情况
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7.3" data-path="PA2-feedback.html">
            
                <a href="PA2-feedback.html">
            
                    
                    PA2提交情况
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7.4" data-path="PA3-feedback.html">
            
                <a href="PA3-feedback.html">
            
                    
                    PA3提交情况
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="feedback.html">
            
                <a href="feedback.html">
            
                    
                    收集课程感想
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >Acquiring Source Code for PAs</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="acquiring-source-code-for-pas">Acquiring Source Code for PAs</h2>
<h3 id="getting-source-code">Getting Source Code</h3>
<p>Go back to the home directory by</p>
<pre><code>cd ~
</code></pre><p>Usually, all works unrelated to system should be performed under the home directory. Other directories under the root of file system (<code>/</code>) are related to system. Therefore, do NOT finish your PAs and Labs under these directories by <code>sudo</code>.</p>
<p><div class="panel"><div class="lab">&#x4E0D;&#x8981;&#x4F7F;&#x7528;root&#x8D26;&#x6237;&#x505A;&#x5B9E;&#x9A8C;!!!</div><div class="word-in-panel"><p>&#x4ECE;&#x73B0;&#x5728;&#x5F00;&#x59CB;, &#x6240;&#x6709;&#x4E0E;&#x7CFB;&#x7EDF;&#x76F8;&#x5173;&#x7684;&#x914D;&#x7F6E;&#x5DE5;&#x4F5C;&#x5DF2;&#x7ECF;&#x5168;&#x90E8;&#x5B8C;&#x6210;, &#x4F60;&#x5DF2;&#x7ECF;&#x6CA1;&#x6709;&#x4F7F;&#x7528;root&#x8D26;&#x6237;&#x7684;&#x5FC5;&#x8981;. &#x7EE7;&#x7EED;&#x4F7F;&#x7528;root&#x8D26;&#x6237;&#x8FDB;&#x884C;&#x5B9E;&#x9A8C;, &#x4F1A;&#x6539;&#x53D8;&#x5B9E;&#x9A8C;&#x76F8;&#x5173;&#x6587;&#x4EF6;&#x7684;&#x6743;&#x9650;&#x5C5E;&#x6027;, &#x53EF;&#x80FD;&#x4F1A;&#x5BFC;&#x81F4;&#x5F00;&#x53D1;&#x8DDF;&#x8E2A;&#x7CFB;&#x7EDF;&#x65E0;&#x6CD5;&#x6B63;&#x5E38;&#x5DE5;&#x4F5C;; &#x66F4;&#x4E25;&#x91CD;&#x7684;, &#x4F60;&#x7684;&#x8BEF;&#x64CD;&#x4F5C;&#x53EF;&#x80FD;&#x4F1A;&#x65E0;&#x610F;&#x4E2D;&#x635F;&#x574F;&#x7CFB;&#x7EDF;&#x6587;&#x4EF6;, &#x5BFC;&#x81F4;&#x865A;&#x62DF;&#x673A;&#x65E0;&#x6CD5;&#x542F;&#x52A8;! &#x5F80;&#x5C4A;&#x6709;&#x82E5;&#x5E72;&#x5B66;&#x957F;&#x56E0;&#x6B64;&#x800C;&#x5F71;&#x54CD;&#x4E86;&#x5B9E;&#x9A8C;&#x8FDB;&#x5EA6;, &#x751A;&#x81F3;&#x7531;&#x4E8E;&#x635F;&#x574F;&#x4E86;&#x5B9E;&#x9A8C;&#x76F8;&#x5173;&#x7684;&#x6587;&#x4EF6;&#x800C;&#x5F71;&#x54CD;&#x4E86;&#x5206;&#x6570;, &#x8BF7;&#x5927;&#x5BB6;&#x5F15;&#x4EE5;&#x4E3A;&#x9274;, &#x4E0D;&#x8981;&#x8D2A;&#x56FE;&#x65B9;&#x4FBF;, &#x5426;&#x5219;&#x540E;&#x679C;&#x81EA;&#x8D1F;!</p>
<p>&#x5982;&#x679C;&#x4F60;&#x4ECD;&#x7136;&#x4E0D;&#x7406;&#x89E3;&#x4E3A;&#x4EC0;&#x4E48;&#x8981;&#x8FD9;&#x6837;&#x505A;, &#x4F60;&#x53EF;&#x4EE5;&#x9605;&#x8BFB;&#x8FD9;&#x4E2A;&#x9875;&#x9762;: <a href="http://askubuntu.com/questions/16178/why-is-it-bad-to-login-as-root" target="_blank">Why is it bad to login as root?</a> &#x6B63;&#x786E;&#x7684;&#x505A;&#x6CD5;&#x662F;: &#x6C38;&#x8FDC;&#x4F7F;&#x7528;&#x4F60;&#x7684;&#x666E;&#x901A;&#x8D26;&#x53F7;&#x505A;&#x90A3;&#x4E9B;&#x5B89;&#x5206;&#x5B88;&#x5DF1;&#x7684;&#x4E8B;&#x60C5;(&#x4F8B;&#x5982;&#x5199;&#x4EE3;&#x7801;), &#x5F53;&#x4F60;&#x9700;&#x8981;&#x8FDB;&#x884C;&#x4E00;&#x4E9B;&#x9700;&#x8981;root&#x6743;&#x9650;&#x624D;&#x80FD;&#x8FDB;&#x884C;&#x7684;&#x64CD;&#x4F5C;&#x65F6;, &#x4F7F;&#x7528;<code>sudo</code>.</p>
</div></div></p>
<p>Now acquire source code for PA by the following command:</p>
<pre><code>git clone https://github.com/NJU-ProjectN/ics2015
</code></pre><p>A directory called <code>ics2015</code> will be created. This is the project directory for PAs. Details will be explained in PA1.</p>
<h3 id="compiling-and-running-nemu">Compiling and Running NEMU</h3>
<p>Before compiling the project, you should install the readline library:</p>
<pre><code>apt-get install libreadline-dev
</code></pre><p>Another important thing to do is <code>git</code> configuration. Issue the following commands:</p>
<pre><code>git config --global user.name &quot;141220000-Zhang San&quot;    # your student ID and name
git config --global user.email &quot;zhangsan@foo.com&quot;    # your email
git config --global core.editor vim            # your favorite editor
git config --global color.ui true
</code></pre><p>You should configure <code>git</code> with your student ID, name, and email. This finishes <code>git</code> configuration.</p>
<p>Finally, you should modify the <code>STU_ID</code> variable in <code>config/Makefile.git</code>:</p>
<pre><code>STU_ID=141220000            # your student ID
</code></pre><p>Now enter the project directory, and compile the project by <code>make</code>:</p>
<pre><code>make
</code></pre><p>If nothing goes wrong, NEMU will be compiled successfully.</p>
<p><div class="panel"><div class="box">What happened?</div><div class="word-in-panel"><p>You should know how a program is generated in the &#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#x57FA;&#x7840; course. But do you have any idea about what happened when a bunch of information is output to the screen during <code>make</code> is executed?</p>
</div></div></p>
<p>To perform a fresh compilation, type</p>
<pre><code>make clean
</code></pre><p>to remove the old compilation result, then <code>make</code> again.</p>
<p>To run NEMU, type</p>
<pre><code>make run
</code></pre><p>However, you will see an error message:</p>
<pre><code>nemu: nemu/src/cpu/reg.c:21: reg_test: Assertion `(cpu.gpr[check_reg_index(i)]._16) == (sample[i] &amp; 0xffff)&apos; failed.
</code></pre><p>This message tells you that the program has triggered an assertion fail at line 21 of the file <code>nemu/src/cpu/reg.c</code>. If you do not know what is assertion, blame the &#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#x57FA;&#x7840; course. If you go to see the line 21 of <code>nemu/src/cpu/reg.c</code>, you will discover the failure is in a test function. This failure is expected, because you have not implemented the register structure correctly. Just ignore it now, and you will fix it in PA1.</p>
<p>To debug NEMU with gdb, type</p>
<pre><code>make gdb
</code></pre><h3 id="development-tracing">Development Tracing</h3>
<p>Once the compilation succeeds, the change of source code will be traced by <code>git</code>. Type</p>
<pre><code>git log
</code></pre><p>If you see something like</p>
<pre><code>commit 4072d39e5b6c6b6837077f2d673cb0b5014e6ef9
Author: tracer-ics2015 &lt;tracer@njuics.org&gt;
Date:   Sun Jul 26 14:30:31 2015 +0800

    &gt; compile NEMU
    141220000
    user
    Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.7-3 i686 GNU/Linux
     14:30:31 up  3:44,  2 users,  load average: 0.28, 0.09, 0.07
    3860572d5cc66412bf85332837c381c5c8c1009f
</code></pre><p>this means the change is traced successfully.</p>
<p>If you see the following message while executing make, this means the tracing fails.</p>
<pre><code>fatal: Unable to create &apos;/home/user/ics2015/.git/index.lock&apos;: File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
</code></pre><p>Try to clean the compilation result and compile again:</p>
<pre><code>make clean
make
</code></pre><p>If the error message above always appears, please contact us as soon as possible.</p>
<p><div class="panel"><div class="lab">&#x5F00;&#x53D1;&#x8DDF;&#x8E2A;</div><div class="word-in-panel"><p>&#x6211;&#x4EEC;&#x4F7F;&#x7528;<code>git</code>&#x5BF9;&#x4F60;&#x7684;&#x5B9E;&#x9A8C;&#x8FC7;&#x7A0B;&#x8FDB;&#x884C;&#x8DDF;&#x8E2A;, &#x4E0D;&#x5408;&#x7406;&#x7684;&#x8DDF;&#x8E2A;&#x8BB0;&#x5F55;&#x4F1A;&#x5F71;&#x54CD;&#x4F60;&#x7684;&#x6210;&#x7EE9;. &#x5F80;&#x5C4A;&#x6709;&#x5B66;&#x957F;&quot;&#x5B8C;&#x6210;&quot;&#x4E86;&#x67D0;&#x90E8;&#x5206;&#x5B9E;&#x9A8C;&#x5185;&#x5BB9;, &#x4F46;&#x6211;&#x4EEC;&#x627E;&#x4E0D;&#x5230;&#x76F8;&#x5E94;&#x7684;git log, &#x6700;&#x7EC8;&#x8BE5;&#x90E8;&#x5206;&#x5185;&#x5BB9;&#x88AB;&#x89C6;&#x4E3A;&#x6CA1;&#x6709;&#x5B8C;&#x6210;. git log&#x662F;&#x72EC;&#x7ACB;&#x5B8C;&#x6210;&#x5B9E;&#x9A8C;&#x7684;&#x6700;&#x6709;&#x529B;&#x8BC1;&#x636E;, &#x5B8C;&#x6210;&#x4E86;&#x5B9E;&#x9A8C;&#x5185;&#x5BB9;&#x5374;&#x7F3A;&#x5C11;&#x5408;&#x7406;&#x7684;git log, &#x4E0D;&#x4EC5;&#x4F1A;&#x635F;&#x5931;&#x5927;&#x91CF;&#x5206;&#x6570;, &#x8FD8;&#x4F1A;&#x7ED9;&#x6284;&#x88AD;&#x5224;&#x5B9A;&#x63D0;&#x4F9B;&#x6700;&#x6709;&#x529B;&#x7684;&#x8BC1;&#x636E;. &#x56E0;&#x6B64;, &#x8BF7;&#x4F60;&#x6CE8;&#x610F;&#x4EE5;&#x4E0B;&#x4E8B;&#x9879;:</p>
<ul>
<li>&#x8BF7;&#x4F60;&#x4E0D;&#x5B9A;&#x671F;&#x67E5;&#x770B;&#x81EA;&#x5DF1;&#x7684;git log, &#x68C0;&#x67E5;&#x662F;&#x5426;&#x4E0E;&#x81EA;&#x5DF1;&#x7684;&#x5F00;&#x53D1;&#x8FC7;&#x7A0B;&#x76F8;&#x7B26;.</li>
<li>&#x63D0;&#x4EA4;&#x5F80;&#x5C4A;&#x4EE3;&#x7801;&#x5C06;&#x88AB;&#x89C6;&#x4E3A;&#x6CA1;&#x6709;&#x63D0;&#x4EA4;.</li>
<li>&#x4E0D;&#x8981;&#x628A;&#x4F60;&#x7684;&#x4EE3;&#x7801;&#x4E0A;&#x4F20;&#x5230;&#x516C;&#x5F00;&#x7684;&#x5730;&#x65B9;.</li>
<li>&#x603B;&#x662F;&#x5728;&#x5DE5;&#x7A0B;&#x76EE;&#x5F55;&#x4E0B;&#x8FDB;&#x884C;&#x5F00;&#x53D1;, &#x4E0D;&#x8981;&#x5728;&#x5176;&#x5B83;&#x5730;&#x65B9;&#x8FDB;&#x884C;&#x5F00;&#x53D1;, &#x7136;&#x540E;&#x4E00;&#x6B21;&#x6027;&#x5C06;&#x4EE3;&#x7801;&#x590D;&#x5236;&#x5230;&#x5DE5;&#x7A0B;&#x76EE;&#x5F55;&#x4E0B;, &#x8FD9;&#x6837;<code>git</code>&#x5C06;&#x4E0D;&#x80FD;&#x6B63;&#x786E;&#x8BB0;&#x5F55;&#x4F60;&#x7684;&#x5F00;&#x53D1;&#x8FC7;&#x7A0B;.</li>
<li>&#x4E0D;&#x8981;&#x4FEE;&#x6539;<code>Makefile</code>&#x4E2D;&#x4E0E;&#x5F00;&#x53D1;&#x8DDF;&#x8E2A;&#x76F8;&#x5173;&#x7684;&#x5185;&#x5BB9;.</li>
</ul>
<p>&#x5076;&#x7136;&#x7684;&#x8DDF;&#x8E2A;&#x5931;&#x8D25;&#x4E0D;&#x4F1A;&#x5F71;&#x54CD;&#x4F60;&#x7684;&#x6210;&#x7EE9;. &#x5982;&#x679C;&#x4E0A;&#x6587;&#x4E2D;&#x7684;&#x9519;&#x8BEF;&#x4FE1;&#x606F;&#x603B;&#x662F;&#x51FA;&#x73B0;, &#x8BF7;&#x5C3D;&#x5FEB;&#x8054;&#x7CFB;&#x6211;&#x4EEC;.</p>
</div></div></p>
<h3 id="local-commit">Local Commit</h3>
<p>Although the development tracing system will trace the change of your code after every successful compilation, the trace record is not suitable for your development. This is because the code is still buggy at most of the time. Also, it is not easy for you to identify those bug-free traces. Therefore, you should trace your bug-free code manually. But before continuing, please read <a href="git.html">this</a> <code>git</code> tutorial to learn some basics of <code>git</code>.</p>
<p>When you want to commit the change, type</p>
<pre><code>git add .
git commit --allow-empty
</code></pre><p>The <code>--allow-empty</code> option is necessary, because usually the change is already committed by development tracing system. Without this option, <code>git</code> will reject no-change commits. If the commit succeeds, you can see a log labeled with your student ID and name by</p>
<pre><code>git log
</code></pre><p>To filter out the commit logs corresponding to your manual commit, use <code>--author</code> option with <code>git log</code>. For details of how to use this option, RTFM.</p>
<h3 id="submission">Submission</h3>
<p>Finally, you should submit your project to the submission website. To submit PA0, put your report file (ONLY <code>.pdf</code> file is accepted) under the project directory. Then issue</p>
<pre><code>make submit
</code></pre><p>This command does 2 things:</p>
<ol>
<li>Clean all unnecessary files for submission</li>
<li>Create an archive containing the source code and your report. The archive is located in the father directory of the project directory, and it is named by your student ID set in Makefile.</li>
</ol>
<p>If nothing goes wrong, transfer the archive to your host. Open the archive to double check whether everything is fine. And you can manually submit this archive to the submission website.</p>
<h2 id="rtfsc-and-enjoy">RTFSC and Enjoy</h2>
<p>If you are new to GNU/Linux and finish this tutorial by yourself, congratulations! You have learn a lot! The most important, you have learn searching the Internet and RTFM for using new tools and trouble-shooting. With these skills, you can solve lots of troubles by yourself during PAs, as well as in the future.</p>
<p>In PA1, the first thing you will do is to <a href="http://i.linuxtoy.org/docs/guide/ch48s06.html" target="_blank">RTFSC</a>. If you have troubles during reading the source code, go to RTFM:</p>
<ul>
<li>If you can not find the definition of a function, it is probably a library function. Read <code>man</code> for more information about that function.</li>
<li>If you can not understand the code related to hardware details, refer to the i386 manual.</li>
</ul>
<p>By the way, you will use C language for programming in all PAs. <a href="http://docs.huihoo.com/c/linux-c-programming" target="_blank">Here</a> is an excellent tutorial about C language. It contains not only C language (such as how to use <code>printf()</code> and <code>scanf()</code>), but also other elements in a computer system (data structure, computer architecture, assembly language, linking, operating system, network...). It covers most parts of this course. You are strongly recommended to read this tutorial.</p>
<p>Finally, enjoy the journey of PAs, and you will find hardware is not mysterious, so does the computer system! But remember:</p>
<ul>
<li><font color="red">The machine is always right.</font></li>
<li><font color="red">Every line of untested code is always wrong.</font></li>
<li><font color="red">RTFM.</font>

</li>
</ul>
<p><div class="panel"><div class="lab">Reminder</div><div class="word-in-panel"><p>This ends PA0. And there is no &#x5FC5;&#x7B54;&#x9898; in PA0.</p>
</div></div></p>
<footer class="page-footer-ex"> <span class="page-footer-ex-copyright"> By <a href="https://sashimi-yzh.github.io/" target="_blank">Zihao Yu</a>, &#x91C7;&#x7528;<a href="http://creativecommons.org/licenses/by-nc-sa/3.0/cn/" target="_blank">&#x77E5;&#x8BC6;&#x5171;&#x4EAB; &#x7F72;&#x540D;-&#x975E;&#x5546;&#x4E1A;&#x6027;&#x4F7F;&#x7528;-&#x76F8;&#x540C;&#x65B9;&#x5F0F;&#x5171;&#x4EAB; 3.0 &#x4E2D;&#x56FD;&#x5927;&#x9646; &#x8BB8;&#x53EF;&#x534F;&#x8BAE;</a>&#x53D1;&#x5E03; </span> &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0; <span class="page-footer-ex-footer-update"> &#x6B64;&#x9875;&#x9762;&#x4FEE;&#x8BA2;&#x4E8E;:  2019-05-03 18:37:10 </span> </footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="0.6.html" class="navigation navigation-prev " aria-label="Previous page: Transferring Files between host and VM">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="PA1.html" class="navigation navigation-next " aria-label="Next page: PA1 - 洞察世界的视点: 简易调试器">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Acquiring Source Code for PAs","level":"1.2.7","depth":2,"next":{"title":"PA1 - 洞察世界的视点: 简易调试器","level":"1.3","depth":1,"path":"PA1.md","ref":"PA1.md","articles":[{"title":"在开始愉快的PA之旅之前","level":"1.3.1","depth":2,"path":"1.1.md","ref":"1.1.md","articles":[]},{"title":"RTFSC","level":"1.3.2","depth":2,"path":"1.2.md","ref":"1.2.md","articles":[]},{"title":"简易调试器","level":"1.3.3","depth":2,"path":"1.3.md","ref":"1.3.md","articles":[{"title":"基本功能","level":"1.3.3.1","depth":3,"path":"1.3.1.md","ref":"1.3.1.md","articles":[]},{"title":"表达式求值","level":"1.3.3.2","depth":3,"path":"1.3.2.md","ref":"1.3.2.md","articles":[]},{"title":"监视点","level":"1.3.3.3","depth":3,"path":"1.3.3.md","ref":"1.3.3.md","articles":[]}]},{"title":"熟悉i386手册","level":"1.3.4","depth":2,"path":"1.4.md","ref":"1.4.md","articles":[]}]},"previous":{"title":"Transferring Files between host and VM","level":"1.2.6","depth":2,"path":"0.6.md","ref":"0.6.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"3.x.x","theme":"default","variables":{},"plugins":["localized-footer","page-footer-ex","ace","nestedmd","mdinhtml"],"pluginsConfig":{"ace":{},"page-footer-ex":{"copyright":"By [Zihao Yu](https://sashimi-yzh.github.io/), 采用[知识共享 署名-非商业性使用-相同方式共享 3.0 中国大陆 许可协议](http://creativecommons.org/licenses/by-nc-sa/3.0/cn/)发布","markdown":true,"update_format":"YYYY-MM-DD HH:mm:ss","update_label":"此页面修订于: "},"mdinhtml":{},"search":{},"localized-footer":{"filename":"FOOTER.md","hline":"true"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"nestedmd":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles.css","pdf":"styles.css"}},"file":{"path":"0.7.md","mtime":"2019-05-03T10:37:10.919Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-03T10:38:47.530Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-ace/ace/ace.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-ace/ace.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

